package hk.polyu;

import java.awt.*;
import java.io.*;
import java.net.URL;

import javax.imageio.ImageIO;
import javax.swing.*;



public class CushionPadPanel extends JPanel {

	/**
	 * 
	 */
	private static final long serialVersionUID = 7544742985437775603L;
	// constructor
	public CushionPadPanel()
	{
		this.setLayout(new BorderLayout());
		
		// Add left panel
		JPanel controlPanel = new JPanel();
		controlPanel.setBorder(BorderFactory.createTitledBorder("Info"));
		// set layout
		controlPanel.setLayout(new GridBagLayout());
		

		// add an label
		JLabel trainLabel = new JLabel("Your current position is: xxx");
		GridBagConstraints c = new GridBagConstraints();
		c.fill = GridBagConstraints.HORIZONTAL;
		c.gridx = 0;
		c.gridy = 0;
		controlPanel.add(trainLabel, c);
	
		this.add(controlPanel, BorderLayout.LINE_START);
		
		/**
		 * Add Map
		 */
		JPanel posPanel = new JPanel();
		posPanel.setBorder(BorderFactory.createTitledBorder("Position"));
		
		Image myPicture = null;
		try {
			ClassLoader cl = this.getClass().getClassLoader();  
	    	URL iconURL = cl.getResource("hk/polyu/image/pos1.png");	
	    	myPicture = ImageIO.read(iconURL).getScaledInstance(270, 400, Image.SCALE_DEFAULT);
		} catch (IOException e) {
			e.printStackTrace();
		}
        final JLabel picLabel = new JLabel(new ImageIcon( myPicture ));
        posPanel.add( picLabel );
		
		this.add(posPanel, BorderLayout.CENTER);
		
	}
	
	
}
